package org.fhm.zdte.protocol.zrudp.standard;

import org.fhm.zdte.protocol.zrudp.service.CommonProtocolMessageConvertor;

import java.util.function.BiFunction;

/**
 * The interface <b>IProtocolMessageConvertor</b>'s implementation is used to covert between Packet-Message-Member and Byte-Array.
 *
 * @author 谭波
 * @since 2024/2/1
 */
public interface IProtocolMessageConvertor {

    /**
     * Obtain a convertor is used to convert Packet-Message-Member to Byte-Array.
     *
     * @return A convertor is used to convert Packet-Message-Member to Byte-Array.
     */
    CommonProtocolMessageConvertor.MessageMemberToByteArray ofMessageMemberToByteArray();

    /**
     * Obtain a convertor is used to convert Byte-Array to Packet-Message-Member.
     *
     * @return A convertor is used to convert Byte-Array to Packet-Message-Member.
     */
    CommonProtocolMessageConvertor.ByteArrayToMessageMember ofByteArrayToMessage();

    /**
     * Obtain a process that how to obtain Packet-Head-Separator.
     *
     * @return Process that how to obtain Packet-Head-Separator.
     */
    BiFunction<byte[], Integer, Boolean> getHeadSeparatorMatcher();

}
